from time import sleep

from selenium import webdriver
# 1.打开浏览器
from selenium.webdriver.support.select import Select

driver = webdriver.Chrome(executable_path='chromedriver.exe')
# driver = webdriver.Chrome() #创建浏览器对象
# 放大浏览器页面
driver.maximize_window()
# 2.输入访问地址（URL）
driver.get("http://121.43.169.97:8848/pageA.html")
# 匿名:Select(element).select_by_index() 下标/索引
# 实名：select=Select(element)
#      select.select_by_index()

# 注意：
# 1.Select类是通过select标签来控制其下option元素
# 2.element : 只能select标签
se = driver.find_element_by_css_selector("#selectA")
select = Select(se)
sleep(2)
# 选择广州
select.select_by_index(2)
# 暂停两秒
sleep(2)
# 选择上海
select.select_by_index(1)
sleep(2)
# 选择深圳
select.select_by_index(3)
sleep(2)



